package com.xukang.sha;



import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * 摘要工具类
 */
public class DigestUtil {

    public static String digest_sha1(String plainText) {
        MessageDigest messageDigest = null;
        try {
            messageDigest = MessageDigest.getInstance("SHA1");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return "";
        }
        messageDigest.update(plainText.getBytes());
        byte[] digest = messageDigest.digest();
        return new String(digest);
    }

}
